from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class userStatus(models.Model):
    name = models.CharField(max_length=100)
    def __str__(self):          
       return self.name
class userProfile(models.Model):
   #username = models.CharField(max_length=100)
   #hashed_password = models.CharField(max_length=100)
   #first_name = models.CharField(max_length=100)
   #last_name = models.CharField(max_length=100)
   #email = models.EmailField(max_length=100)
   user = models.OneToOneField(User)
   #created = models.DateTimeField(auto_now=False, auto_now_add=False)
   #last_activity = models.DateTimeField(auto_now=False, auto_now_add=False)
   #is_moderator = models.BooleanField(default=False)
   user_status = models.ForeignKey(userStatus)
   def __str__(self):          
       return self.user.first_name+" "+self.user.last_name
class discussionStatus(models.Model):
    name = models.CharField(max_length=100)
    def __str__(self):          
       return self.name
class discussionThread(models.Model):
    subject = models.CharField(max_length=100)
    discussionbody = models.CharField(max_length=5000,default="No Body")
    created = models.DateTimeField(auto_now=False, auto_now_add=False)
    user_id = models.ForeignKey(User)
    status = models.ForeignKey(discussionStatus)
    rating = models.IntegerField(default=0)
    def __str__(self):          
       return self.subject
class discussionPost(models.Model):
    content = models.TextField(max_length=1000)
    created = models.DateTimeField(auto_now=False, auto_now_add=False)
    thread_id = models.ForeignKey(discussionThread)
    user_id = models.ForeignKey(User)
    status = models.ForeignKey(discussionStatus)
    vote = models.IntegerField(default=0)
    def __str__(self):          
       return self.content
    

  